package com.wyf.cnbeta;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.umeng.analytics.MobclickAgent;

public class AboutActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        setTitle("关于");
        findViewById(R.id.updata_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });

        TextView ver_text=(TextView)findViewById(R.id.version_text);
        ver_text.setText(getVersion());


    }
    public void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }
    public void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }
    /**
     * 获取版本号
     * @return 当前应用的版本号
     */
    public String getVersion()
    {

        try {
            PackageManager manager = this.getPackageManager();
            PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
            String version = info.versionName;
            //return this.getString(R.string.version_name) + version;
            return  "Ver:"+version;
        } catch (Exception e)
        {
            e.printStackTrace();
            //return this.getString(R.string.can_not_find_version_name);
        }
        return null;
    }

}
